package com.ssss.iter;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.ArrayList;

@NoArgsConstructor
@AllArgsConstructor
public class ConcreateAggregate implements Aggregate{

    private ArrayList arrayList = new ArrayList();

    @Override
    public void add(Object object) {
        this.arrayList.add(object);
    }

    @Override
    public void remove(Object object) {
        this.arrayList.remove(object);
    }

    @Override
    public Iterator iterator() {
        return (Iterator) new ConcreateAggregate(this.arrayList);
    }
}
